//封装本地存储操作模块

//存储数据
export const setItem = (key, value) => {
    localStorage.setItem(key, typeof value === 'object' ? JSON.stringify(value) : value)
}
//获取数据
export const getItem = key => {
    try {
        return JSON.parse(localStorage.getItem(key))
    }
    catch (err) {
        return localStorage.getItem(key)
    }
}
//删除数据
export const removeItem = key => {
    localStorage.removeItem(key)
}